(* Content-type: application/vnd.wolfram.mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 10.4' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       158,          7]
NotebookDataLength[     10199,        282]
NotebookOptionsPosition[      9434,        255]
NotebookOutlinePosition[      9771,        270]
CellTagsIndexPosition[      9728,        267]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{
Cell[BoxData[
 RowBox[{"(*", " ", 
  RowBox[{"UnitaryHermitian", ".", "ma"}], "*)"}]], "Input",
 CellChangeTimes->{{3.6818447973974133`*^9, 3.681844803945376*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{"V", "[", "eps", "]"}], "=", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"{", 
      RowBox[{
       RowBox[{"Cos", "[", "eps", "]"}], ",", 
       RowBox[{"I", "*", 
        RowBox[{"Sin", "[", "eps", "]"}]}]}], "}"}], ",", 
     RowBox[{"{", 
      RowBox[{
       RowBox[{"I", "*", 
        RowBox[{"Sin", "[", "eps", "]"}]}], ",", 
       RowBox[{"Cos", "[", "eps", "]"}]}], "}"}]}], "}"}]}], ";"}]], "Input",
 CellChangeTimes->{{3.681844861647524*^9, 3.681844861665798*^9}, {
   3.68184489827125*^9, 3.681844933383853*^9}, 3.681846226772765*^9, 
   3.681846984840808*^9, {3.681847632132924*^9, 3.681847640737296*^9}, {
   3.681857073909396*^9, 3.681857078673162*^9}, {3.681859740404522*^9, 
   3.681859740932946*^9}, {3.681860572395999*^9, 3.681860572920624*^9}, 
   3.6819897202080297`*^9, {3.6819903568795443`*^9, 3.681990358379712*^9}, {
   3.6819904146472178`*^9, 3.681990417080711*^9}}],

Cell[BoxData[
 RowBox[{"MatrixForm", "[", 
  RowBox[{"{", 
   RowBox[{
    RowBox[{"{", 
     RowBox[{
      RowBox[{"Cos", "[", "eps", "]"}], ",", 
      RowBox[{"\[ImaginaryI]", " ", 
       RowBox[{"Sin", "[", "eps", "]"}]}]}], "}"}], ",", 
    RowBox[{"{", 
     RowBox[{
      RowBox[{"\[ImaginaryI]", " ", 
       RowBox[{"Sin", "[", "eps", "]"}]}], ",", 
      RowBox[{"Cos", "[", "eps", "]"}]}], "}"}]}], "}"}], "]"}]], "Input",
 NumberMarks->False],

Cell[BoxData[
 RowBox[{
  RowBox[{"dV", "=", 
   RowBox[{"D", "[", 
    RowBox[{
     RowBox[{"V", "[", "eps", "]"}], ",", "eps"}], "]"}]}], ";"}]], "Input",
 CellChangeTimes->{{3.681844974986565*^9, 3.6818449750035963`*^9}, 
   3.681846235649312*^9, 3.681847073786498*^9, {3.681859752594949*^9, 
   3.681859753022049*^9}, {3.6818598315194597`*^9, 3.6818598321345253`*^9}, {
   3.681860580739112*^9, 3.681860589696568*^9}, {3.681860624456286*^9, 
   3.681860625439846*^9}, {3.68186066040143*^9, 3.681860661898757*^9}, 
   3.681860741053823*^9, {3.681990377628903*^9, 3.681990378558085*^9}}],

Cell[BoxData[
 RowBox[{"MatrixForm", "[", 
  RowBox[{"D", "[", 
   RowBox[{
    RowBox[{"V", "[", "eps", "]"}], ",", "eps"}], "]"}], "]"}]], "Input",
 CellChangeTimes->{{3.6818606350314074`*^9, 3.681860684455297*^9}}],

Cell["\<\
Here they try to invert matrix V by hand, but it does not work, better to use \
standart inversion.\
\>", "Text",
 CellChangeTimes->{{3.6819890956808653`*^9, 3.6819891343495283`*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"VIt", ":=", 
   RowBox[{"Inverse", "[", 
    RowBox[{"V", "[", "eps", "]"}], "]"}]}], ";"}]], "Input",
 CellChangeTimes->{{3.6819892288567867`*^9, 3.681989268686157*^9}, {
   3.681989362886263*^9, 3.6819893670910587`*^9}, 3.681989430707699*^9, 
   3.681990022122368*^9}],

Cell[BoxData[
 RowBox[{"(*", 
  RowBox[{
   RowBox[{"VI", ":=", 
    RowBox[{
     RowBox[{"V", "[", "eps", "]"}], "/.", 
     RowBox[{"{", 
      RowBox[{"I", "->", 
       RowBox[{"-", "I"}]}], "}"}]}]}], ";"}], "*)"}]], "Input",
 CellChangeTimes->{{3.681845045876419*^9, 3.6818450458898497`*^9}, {
   3.681845690892583*^9, 3.681845722383657*^9}, 3.681846003096932*^9, {
   3.6818460896137667`*^9, 3.68184609719*^9}, {3.681846357095639*^9, 
   3.6818463595447187`*^9}, {3.6818464108862553`*^9, 3.681846412034512*^9}, 
   3.68184716544331*^9, 3.68184730454148*^9, {3.681847384379826*^9, 
   3.681847385940824*^9}, {3.681847567982028*^9, 3.6818475722631598`*^9}, {
   3.68185930452109*^9, 3.681859306503502*^9}, {3.681859844921719*^9, 
   3.681859846267023*^9}, {3.681860781276795*^9, 3.681860791479002*^9}, 
   3.681861032119155*^9, 3.68186117275114*^9, 3.681896768477495*^9, {
   3.681989328332747*^9, 3.681989332398345*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"VI", "=", 
   RowBox[{"Simplify", "[", "VIt", "]"}]}], ";"}]], "Input",
 CellChangeTimes->{{3.681858879311988*^9, 3.68185891958154*^9}, {
   3.681858949752295*^9, 3.681858950854405*^9}, {3.681859854890415*^9, 
   3.6818598552479067`*^9}, {3.681860830792255*^9, 3.681860831376141*^9}, 
   3.681896774639697*^9, {3.681989454523315*^9, 3.681989458892027*^9}, {
   3.681989849869088*^9, 3.681989852076076*^9}, {3.681989888051818*^9, 
   3.681989894380374*^9}, {3.6819899805963593`*^9, 3.681989989645361*^9}, 
   3.6819900322704782`*^9, {3.681990085385791*^9, 3.681990092711781*^9}, {
   3.681990145529696*^9, 3.681990154865898*^9}}],

Cell[BoxData[
 RowBox[{"(*", 
  RowBox[{
   RowBox[{"VI", "=", 
    RowBox[{"Transpose", "[", 
     RowBox[{"VI", "[", "eps", "]"}], "]"}]}], ";"}], "*)"}]], "Input",
 CellChangeTimes->{{3.681845087350252*^9, 3.68184509524627*^9}, {
   3.6818463696591473`*^9, 3.6818463727936983`*^9}, {3.681846418259635*^9, 
   3.681846419048684*^9}, {3.681846532139824*^9, 3.68184656841546*^9}, {
   3.681846628840517*^9, 3.6818466367065277`*^9}, {3.681847479796338*^9, 
   3.681847484842698*^9}, {3.6818593185585403`*^9, 3.681859327006166*^9}, {
   3.68186086971968*^9, 3.6818608766260023`*^9}, {3.681861043846774*^9, 
   3.681861048945266*^9}, {3.681861098243931*^9, 3.681861101191202*^9}, {
   3.681861183228972*^9, 3.68186121223864*^9}, 3.681896788097426*^9, {
   3.681896870779767*^9, 3.681896872306341*^9}, 3.681897067970284*^9, {
   3.681989342009952*^9, 3.681989345555461*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"K", "=", 
   RowBox[{
    RowBox[{"-", "I"}], "*", 
    RowBox[{"dV", ".", "VI"}]}]}], ";"}]], "Input",
 CellChangeTimes->{{3.681845187774323*^9, 3.681845204124486*^9}, {
   3.681845240851554*^9, 3.6818452518629637`*^9}, {3.6818464294891243`*^9, 
   3.681846430611915*^9}, {3.681847496463601*^9, 3.6818474989816437`*^9}, {
   3.681859335840768*^9, 3.681859337767376*^9}, {3.681859373598257*^9, 
   3.68185937432648*^9}, {3.681859542539298*^9, 3.681859558726248*^9}, {
   3.681859883368943*^9, 3.681859887467389*^9}, {3.681860104480844*^9, 
   3.6818601105050287`*^9}, {3.68186126680196*^9, 3.681861281845256*^9}, 
   3.681897176733491*^9, {3.681989509442278*^9, 3.681989509985524*^9}, {
   3.68199021217169*^9, 3.6819902128440027`*^9}, {3.681990885157887*^9, 
   3.68199095084814*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"Simplify", "[", "K", "]"}], ";"}]], "Input",
 CellChangeTimes->{{3.6819909838499727`*^9, 3.681990996100643*^9}}],

Cell[BoxData[
 RowBox[{"MatrixForm", "[", 
  RowBox[{"{", 
   RowBox[{
    RowBox[{"{", 
     RowBox[{"0", ",", "1"}], "}"}], ",", 
    RowBox[{"{", 
     RowBox[{"1", ",", "0"}], "}"}]}], "}"}], "]"}]], "Input",
 NumberMarks->False],

Cell["\<\
Below is an example which is described  in the Internet as an example for \
infinite recursion, but it is OK in current versions of Mathematica\
\>", "Text",
 CellChangeTimes->{{3.68199443168018*^9, 3.681994477927702*^9}, {
  3.6822717360168*^9, 3.6822717518292513`*^9}, {3.682290764107723*^9, 
  3.682290768953587*^9}}],

Cell[BoxData[{
 RowBox[{
  RowBox[{"a", "=", "2"}], "\[IndentingNewLine]", 
  RowBox[{"(*", "2", "*)"}], "\n"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"T", "=", 
   RowBox[{"2", "^", 
    RowBox[{"(", 
     RowBox[{"3", "/", "2"}], ")"}]}]}], "\[IndentingNewLine]", 
  RowBox[{"(*", 
   RowBox[{"2", " ", 
    RowBox[{"Sqrt", "[", "2", "]"}]}], "*)"}], "\n"}], "\[IndentingNewLine]", 

 RowBox[{
  RowBox[{
   RowBox[{"x", "[", "t_", "]"}], "=", 
   RowBox[{
    RowBox[{"a", " ", 
     RowBox[{"Cos", "[", 
      RowBox[{"2", " ", "Pi", " ", 
       RowBox[{"t", "/", "T"}]}], "]"}]}], "-", 
    RowBox[{"Cos", "[", 
     RowBox[{"2", " ", "Pi", " ", "t"}], "]"}]}]}], "\[IndentingNewLine]", 
  RowBox[{"(*", 
   RowBox[{
    RowBox[{"-", 
     RowBox[{"Cos", "[", 
      RowBox[{"2", " ", "\[Pi]", " ", "t"}], "]"}]}], "+", 
    RowBox[{"2", " ", 
     RowBox[{"Cos", "[", 
      RowBox[{
       RowBox[{"(", 
        RowBox[{"\[Pi]", " ", "t"}], ")"}], "/", 
       RowBox[{"Sqrt", "[", "2", "]"}]}], "]"}]}]}], "*)"}], 
  "\n"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"y", "[", "t_", "]"}], "=", 
   RowBox[{
    RowBox[{"a", " ", 
     RowBox[{"Sin", "[", 
      RowBox[{"2", " ", "Pi", " ", 
       RowBox[{"t", "/", "T"}]}], "]"}]}], "-", 
    RowBox[{"Sin", "[", 
     RowBox[{"2", " ", "Pi", " ", "t"}], "]"}]}]}], "\[IndentingNewLine]", 
  RowBox[{"(*", 
   RowBox[{
    RowBox[{"-", 
     RowBox[{"Sin", "[", 
      RowBox[{"2", " ", "\[Pi]", " ", "t"}], "]"}]}], "+", 
    RowBox[{"2", " ", 
     RowBox[{"Sin", "[", 
      RowBox[{
       RowBox[{"(", 
        RowBox[{"\[Pi]", " ", "t"}], ")"}], "/", 
       RowBox[{"Sqrt", "[", "2", "]"}]}], "]"}]}]}], "*)"}], 
  "\n"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"f", "[", "t_", "]"}], "=", 
  RowBox[{
   RowBox[{"x", "[", "t", "]"}], "+", 
   RowBox[{"I", " ", 
    RowBox[{"y", "[", "t", "]"}]}]}]}]}], "Input",
 CellChangeTimes->{{3.681859483337989*^9, 3.681859483349052*^9}}]
},
WindowSize->{1366, 713},
WindowMargins->{{0, Automatic}, {Automatic, 0}},
FrontEndVersion->"10.4 for Linux x86 (64-bit) (February 25, 2016)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[558, 20, 163, 3, 32, "Input"],
Cell[724, 25, 942, 22, 32, "Input"],
Cell[1669, 49, 457, 14, 32, "Input"],
Cell[2129, 65, 590, 11, 32, "Input"],
Cell[2722, 78, 217, 5, 32, "Input"],
Cell[2942, 85, 193, 4, 33, "Text"],
Cell[3138, 91, 305, 7, 32, "Input"],
Cell[3446, 100, 927, 18, 32, "Input"],
Cell[4376, 120, 663, 11, 32, "Input"],
Cell[5042, 133, 870, 15, 32, "Input"],
Cell[5915, 150, 820, 15, 32, "Input"],
Cell[6738, 167, 147, 3, 32, "Input"],
Cell[6888, 172, 233, 8, 32, "Input"],
Cell[7124, 182, 330, 6, 33, "Text"],
Cell[7457, 190, 1973, 63, 297, "Input"]
}
]
*)

